package view;

import javax.microedition.midlet.MIDlet;

import util.MoneyControlConstants;

import com.sun.lwuit.Button;
import com.sun.lwuit.Form;
import com.sun.lwuit.Image;
import com.sun.lwuit.layouts.BoxLayout;

import controller.MenuHandler;

public class Menu extends Form
{

	private Object options[][] = MoneyControlConstants.getMenuItens();
	private MIDlet midlet;
	private MenuHandler handler;
	
	public Menu(MIDlet m)
	{
		super("Menu");

		this.midlet = m;
		this.handler = new MenuHandler(this.midlet);
		
		this.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
		
		for(int i=0; i < this.options.length; i++ )
		{
			Button bt = new Button((String) this.options[i][0], (Image) this.options[i][1]);
			bt.setStyle(MoneyControlConstants.getButtonStyle(bt.getStyle()));
			bt.addActionListener(this.handler);
			this.addComponent(bt);				
		}
		
		this.show();
	}
	
	public Object[][] getOptions()
	{
		return this.options;
	}

	public void setOptions(Object[][] options)
	{
		this.options = options;
	}
	
}
